<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width,user-scalable=no"name="viewport">
<title>添加员工</title>
<link rel="stylesheet" type="text/css" href="<?php echo C('WEB_URL');?>Public/business/style/base.css" />
<link rel="stylesheet" type="text/css" href="<?php echo C('WEB_URL');?>Public/business/style/style.css" />
<link rel="stylesheet" type="text/css" href="<?php echo C('WEB_URL');?>Public/business/style/bootstrap.min.css" />
<script type="text/javascript" charset="UTF-8" src="<?php echo C('WEB_URL');?>Public/business/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="<?php echo C('WEB_URL');?>Public/business/js/bootstrap.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="<?php echo C('WEB_URL');?>Public/business/js/script.js"></script>
</head>
<body>
<div id="box">
 <div class="navbar navbar-default navbar-fixed-top">
  <header>
   <h1><a href="manage.html"><span class="glyphicon glyphicon-menu-left"></span></a></h1>
   <p class="title">添加员工</p>
  </header>
 </div><!--navbar-fixed-top-->
 <div class="member">
  <div class="addMem">
   <form id="myForm" method="post">
    <div class="addList">
     <label>员工手机号</label>
     <input type="tel" id='tel' name="tel" placeholder="请输入员工手机号" />
    <p id="po1"></p>
    </div><!--addList-->
    <div class="addList">
   	 <label>验证码</label> 
   	 <input type="number" id="yzm" name="yzm" placeholder="请输入顾客收到的验证码" class="verifyInput" />
   	 <input type="button" id="btn" value="发送验证码" onclick="settime(this)" class="verifyBut" />
    </div><!--addList-->
    <p class="add" id="cun">确认添加</p>
   </form> 
  </div><!--addMem-->
 </div><!--member-->
 <div class="navbar navbar-default navbar-fixed-bottom">
   <footer>
    <dl>
     <dt><a href="index.html"><img src="<?php echo C('WEB_URL');?>Public/business/images/index_06.jpg" /></a></dt>
     <dd><a href="index.html">首页</a></dd>
    </dl>
    <dl>
     <dt><a href="pullrefresh_sub.html"><img src="<?php echo C('WEB_URL');?>Public/business/images/deal_07.jpg" /></a></dt>
     <dd><a href="pullrefresh_sub.html">员工管理</a></dd>
    </dl>
    <dl>
     <dt><a href="manage.html"><img src="<?php echo C('WEB_URL');?>Public/business/images/footer_02.jpg" /></a></dt>
     <dd><a href="manage.html" class="current">会员管理</a></dd>
    </dl>
   </footer>
  </div><!--/navbar-->
</div><!--box-->
<!--会员卡续费成功弹出页面 -->
 <div id="popup"><a href="memList.html" class="a_click">
  <div id="click_div">
   <div id="dialog">
	<h3><img src="<?php echo C('WEB_URL');?>Public/business/images/paysuc_03.jpg" /></h3>
	<h5>恭喜您，</h5>
	<h5>已成功添加<span>18017744567</span>为本店会员！</h5>
  </div>
 </div></a>
</div>
 <!--会员卡续费成功弹出页面 End-->
<script type="text/javascript">
//微信判断header是否显示
if(isWeiXin()){ 
//alert("====");
$(".title").hide();
} 
else{
//alert("+++++");
}

$('#btn').click(function(){
	var phone=$('#tel').val();
	var type=1;
	
	$.ajax({
		  type:'GET',
		  url:"<?php echo C('WEB_URL');?>home/Api/sendcode",
		  dataType: "json",
		  data:{"phone":phone,"type":type	},
		  success:function(data){
			 
			  }
		  		
})


})



 //会员卡续费成功弹出页面 JS
$("#but").click(function(){
	var vars=$('#tel').val();
	$.ajax({
		  type:'POST',
		  url:'<?php echo U("Business/register");?>',
		  dataType: "json",
		  data: 'tel='+vars,
		  success:function(data){
		  
		  	if(data==1){
		  	$("#click_div").show(),8000;
		  	}
		  }
		});
	})  

		$(".a_click").click(function(){
			$("#click_div").hide();
			});

</script>

<script>
	$('#tel').blur(function(){
	var vars=$('#tel').val();
	
	$.ajax({
		  type:'POST',
		  url:'<?php echo U("Business/telyz");?>',
		  dataType: "json",
		  data: 'tel='+vars,
		  success:function(data){
		  	if(data==1){
		  		alert(' 该手机已经被注册')
		  	}
		  	if(data==3){
		  		$('#tel').val('手机格式不正确')
		  	}
		  }
		});
	})
	
	
	
 function check_form(form_id) {
              last_submit = $('#' + form_id).data('last_submit');
              current_submit = new Date().getTime();
              if (last_submit == undefined) {
                $('#' + form_id).data('last_submit', new Date().getTime());
              } else {
                if (current_submit - last_submit > 600) {
                  $('#' + form_id).data('last_submit', new Date().getTime());
                } else {
                  return false;
                }
              }
              if ( typeof (tinyMCE) != 'undefined') {
                tinyMCE.triggerSave(true);
              }

              var check_flag = true;
              $("#" + form_id + " :input").each(function(i) {
                if ($(this).attr("check")) {
                  if (!validate($(this).val(), $(this).attr("check"))) {
                    ui_error($(this).attr("msg"));
                    $(this).focus();
                    check_flag = false;
                    return check_flag;
                  }
                }
              });
              return check_flag;
            }


      function sendForm(formId, post_url, return_url) {
            if (check_form(formId)) {
              //绑定beforeunload事件
              $(window).unbind('beforeunload', null);
              if ($("#ajax").val() == 1) {
                var vars = $("#" + formId).serialize();
                $.ajax({
                  type : "POST",
                  url : post_url,
                  data : vars,
                  dataType : "json",
                  success : function(data) {
                    if (data.status) {
                      ui_alert(data.info, function() {
                        if (return_url) {
                          location.href = return_url;
                        }
                      });
                    } else {
                      ui_error(data.info);
                    }
                  }
                });
              } else {
                $("#" + formId).attr("action", post_url);
                if (return_url) {
                  set_cookie('return_url', return_url);
                }
                $("#" + formId).submit();
              }
            }
          }
          $('#cun').click(function(){
            sendForm("myForm","<?php echo U('Business/addstaff');?>");
          })
</script>



</body>
</html>